<html>
<head>
<title>MTurk Task</title>
<meta>
<style>

</style>
</meta>
<style>

</style>
</head>
<body>
<script src="/jquery.js"></script>
<script src="/myutil.js"></script>
<script src="/rand.js"></script>
<script>

$(function () {
    var params = getURLParams()
    if (params.assignmentId) {
        if (params.assignmentId == "ASSIGNMENT_ID_NOT_AVAILABLE") {
            $('input').attr("disabled", "true")
            $('textarea').attr("disabled", "true")
            $('button').attr("disabled", "true")
        } else {
        	if ($('*[name]').length < 2) {
        		$('input[type=submit]').attr('name', 'submit')
        	}
        	if ($('*[name]').length < 2) {
        		$('#assignmentId').after('<input type="hidden" name="default" value="default"></input>')
        	}
        }
        $('#assignmentId').attr('value', params.assignmentId)
        $('form').attr('method', 'POST')
    }
    if (params.turkSubmitTo) {
        $('form').attr('action', params.turkSubmitTo + '/mturk/externalSubmit')
    }

    var r = $('.random')
    if (r.length > 0) {
	    seed(<%=seed%>)
		Math.random = rand    
	    $(shuffle(r.after('<div/>').next().get())).each(function (i) {
	        $(this).after(r[i]).remove()
	    })
	}    
})

</script>

<form action="." method="GET">
    <input type="hidden" name="assignmentId" id="assignmentId" value="temp"></input>
    <input type="hidden" name="ip" id="ip" value="<%=ip%>"></input>
    ___CONTENT___
</form>

</body>
</html>
